-- summon_continue_damage
-- create by zhuangsl
-- 技能：对随机一个怪物造成多次伤害
-- 配置：summon_continue_damage(2000, 3)：连续3次伤害，每次2倍攻击
return {
    apply = function(source, target, skillId, round, para, extra)
        -- 威力
        local force = para[1];

        -- 攻击方的攻击
        local attack = source:getAttack();

        -- 伤害
        local damage = math.modf(attack * force / 1000);

        local count = para[2];
        for index = 1, count do
            -- 增加命中动作
            if SkillM.getSequence(target) == nil then
                SkillM.getSequenceList()[target] = CastSequence.create(source, target, skillId);
            end
            SkillM.getSequence(target):hit(source, target, skillId);
            -- 受创
            CombatM.receiveDamage(source, target, damage, skillId, extra);

            -- 如果目标已经死了，停止攻击
            if target:isDead() then
                break;
            end
        end

        -- 作用目标
        return target;
    end,

    parse = function(desc)
        local arr = string.explode(desc, ",");
        return { tonumber(arr[1]), tonumber(arr[2]),};
    end,

    -- 解析技能描述
    parseDesc = function(source, skillId, desc, para)
        -- 威力
        local force = para[1];

        -- 攻击
        local attack = source:getAttack();

        -- 伤害
        local damage = math.modf(force * attack / 1000);

        desc = string.gsub(desc, "{damage}", damage);

        return desc;
    end,
};
